package com.cntcdt.api.db.dao;


import java.util.List;

import com.cntcdt.api.db.dao.base.ConsociationCompanyDivideDaoBase;
import com.cntcdt.api.db.model.ConsociationCompanyDivideModel;

/**
 * 这是cdt_consociation_company_divide的Dao实现类
 */
public class ConsociationCompanyDivideDao extends ConsociationCompanyDivideDaoBase   {
    /**
     * ConsociationCompanyDivideDao对象
     */
    private static ConsociationCompanyDivideDao instance = new ConsociationCompanyDivideDao();

    /**
     * 默认构造方法
     */
    private ConsociationCompanyDivideDao() {
    }

    /**
     * 获得对象实例
     */
    public static ConsociationCompanyDivideDao getInstance() { 
         return instance;
    } 
    
    /**
     * 按集团id查询分成规则
     * @param id id
     * @return model
     */
    public ConsociationCompanyDivideModel findByConsociationCompanyId(Integer consociationCompanyId) {
        String sql = "SELECT * FROM " + TABLE + " WHERE consociationCompanyId = ?";
       Object[] paramObjs = {consociationCompanyId};
       List<ConsociationCompanyDivideModel > modelList = this.queryModelList(sql, paramObjs);
       if(modelList.size() > 0){
    	   return modelList.get(0);
       }
       return null;
   }  
    
    /**
     * 按分页查询数据
     * @param id id
     * @return model
     */
    public List<ConsociationCompanyDivideModel > findByPage(int sortTime) {
       sortTime = sortTime*50;
       String sql = "SELECT * FROM " + TABLE + " limit ?,50";
       Object[] paramObjs = {sortTime};
       List<ConsociationCompanyDivideModel > modelList = this.queryModelList(sql, paramObjs);
       return modelList;
   }

}
